package com.ruoyi.rawmaterial.controller;


import com.ruoyi.common.core.constant.SecurityConstants;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.rawmaterial.service.MaterialService;
import com.ruoyi.system.api.RemoteFarmerService;
import com.ruoyi.system.api.RemoteLogisticsService;
import com.ruoyi.system.api.domain.TraceTransport;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author 86132
 */
@RestController
@RequestMapping("/traces/material")
public class MaterialController {
    @Autowired
    private MaterialService materialService;
    @Autowired
    private RemoteLogisticsService remoteLogisticsService;
    @Autowired
    private RemoteFarmerService farmerService;
    @GetMapping("/listCrops/{deptId}")
    public AjaxResult listCrops(@PathVariable("deptId") String deptId){
        return AjaxResult.success(remoteLogisticsService.listCrops(deptId, SecurityConstants.INNER).getData());
    }

    /**
     * @author wx
     * @Date 23:47 2020/11/7 0007
     * @Param [cropsId] 出库
     * @return com.ruoyi.common.core.domain.AjaxResult
     **/
    @GetMapping("/changeInToOut/{cropsId}")
    public AjaxResult changeInToOut(@PathVariable("cropsId") String cropsId){
        return AjaxResult.success(remoteLogisticsService.changeInToOut(cropsId,SecurityConstants.INNER));
    }


    @PostMapping("/addTransport")
    public AjaxResult addTransport(@RequestBody TraceTransport traceTransport){
        return AjaxResult.success(remoteLogisticsService.addTransport(traceTransport,SecurityConstants.INNER));
    }

    /**
     * 通知运输
     * @return
     */
    @RequestMapping("/notifyTransportation")
    public AjaxResult notifyTransportation(){
        return AjaxResult.success();
    }

    /**
     * 检测出库
     * @return
     */
    @RequestMapping("/inspectionInToOut")
    public AjaxResult inspectionInToOut(){
        return AjaxResult.success();
    }
}
